\(\int \cos (c+d x) (a+a \sec (c+d x)) (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [309]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 36, antiderivative size = 32 \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=a B x+\frac {a (B+C) \text {arctanh}(\sin (c+d x))}{d}+\frac {a C \tan (c+d x)}{d} \]

[Out]

a*B*x+a*(B+C)*arctanh(sin(d*x+c))/d+a*C*tan(d*x+c)/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 32, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.139, Rules used = {4157, 3999, 3852, 8, 3855} \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {a (B+C) \text {arctanh}(\sin (c+d x))}{d}+a B x+\frac {a C \tan (c+d x)}{d} \]

[In]

Int[Cos[c + d*x]*(a + a*Sec[c + d*x])*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

a*B*x + (a*(B + C)*ArcTanh[Sin[c + d*x]])/d + (a*C*Tan[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3999

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))*(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_)), x_Symbol] :> Simp[a*c*x, x]
 + (Dist[b*d, Int[Csc[e + f*x]^2, x], x] + Dist[b*c + a*d, Int[Csc[e + f*x], x], x]) /; FreeQ[{a, b, c, d, e,
f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 4157

Int[((a_.) + csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(
x_)]^2*(C_.))*((c_.) + csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.), x_Symbol] :> Dist[1/b^2, Int[(a + b*Csc[e + f*x])
^(m + 1)*(c + d*Csc[e + f*x])^n*(b*B - a*C + b*C*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps \begin{align*} \text {integral}& = \int (a+a \sec (c+d x)) (B+C \sec (c+d x)) \, dx \\ & = a B x+(a C) \int \sec ^2(c+d x) \, dx+(a (B+C)) \int \sec (c+d x) \, dx \\ & = a B x+\frac {a (B+C) \text {arctanh}(\sin (c+d x))}{d}-\frac {(a C) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{d} \\ & = a B x+\frac {a (B+C) \text {arctanh}(\sin (c+d x))}{d}+\frac {a C \tan (c+d x)}{d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 43, normalized size of antiderivative = 1.34 \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=a B x+\frac {a B \text {arctanh}(\sin (c+d x))}{d}+\frac {a C \text {arctanh}(\sin (c+d x))}{d}+\frac {a C \tan (c+d x)}{d} \]

[In]

Integrate[Cos[c + d*x]*(a + a*Sec[c + d*x])*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

a*B*x + (a*B*ArcTanh[Sin[c + d*x]])/d + (a*C*ArcTanh[Sin[c + d*x]])/d + (a*C*Tan[c + d*x])/d

Maple [A] (verified)

Time = 0.23 (sec) , antiderivative size = 57, normalized size of antiderivative = 1.78

method result size
derivativedivides \(\frac {a B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+C a \tan \left (d x +c \right )+a B \left (d x +c \right )+C a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(57\)
default \(\frac {a B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+C a \tan \left (d x +c \right )+a B \left (d x +c \right )+C a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{d}\) \(57\)
parallelrisch \(-\frac {\left (\cos \left (d x +c \right ) \left (B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )-\cos \left (d x +c \right ) \left (B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )-B x d \cos \left (d x +c \right )-C \sin \left (d x +c \right )\right ) a}{d \cos \left (d x +c \right )}\) \(81\)
risch \(a B x +\frac {2 i C a}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) C}{d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) C}{d}\) \(105\)
norman \(\frac {a B x +a B x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{6}+\frac {2 C a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-\frac {2 C a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{5}}{d}-a B x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-a B x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{4}}{\left (1+\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}\right ) \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2}-1\right )^{2}}+\frac {a \left (B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{d}-\frac {a \left (B +C \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{d}\) \(160\)

[In]

int(cos(d*x+c)*(a+a*sec(d*x+c))*(B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*B*ln(sec(d*x+c)+tan(d*x+c))+C*a*tan(d*x+c)+a*B*(d*x+c)+C*a*ln(sec(d*x+c)+tan(d*x+c)))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 79 vs. \(2 (32) = 64\).

Time = 0.26 (sec) , antiderivative size = 79, normalized size of antiderivative = 2.47 \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, B a d x \cos \left (d x + c\right ) + {\left (B + C\right )} a \cos \left (d x + c\right ) \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (B + C\right )} a \cos \left (d x + c\right ) \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, C a \sin \left (d x + c\right )}{2 \, d \cos \left (d x + c\right )} \]

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/2*(2*B*a*d*x*cos(d*x + c) + (B + C)*a*cos(d*x + c)*log(sin(d*x + c) + 1) - (B + C)*a*cos(d*x + c)*log(-sin(d
*x + c) + 1) + 2*C*a*sin(d*x + c))/(d*cos(d*x + c))

Sympy [F]

\[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=a \left (\int B \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx + \int B \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int C \cos {\left (c + d x \right )} \sec ^{2}{\left (c + d x \right )}\, dx + \int C \cos {\left (c + d x \right )} \sec ^{3}{\left (c + d x \right )}\, dx\right ) \]

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))*(B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

a*(Integral(B*cos(c + d*x)*sec(c + d*x), x) + Integral(B*cos(c + d*x)*sec(c + d*x)**2, x) + Integral(C*cos(c +
 d*x)*sec(c + d*x)**2, x) + Integral(C*cos(c + d*x)*sec(c + d*x)**3, x))

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 73 vs. \(2 (32) = 64\).

Time = 0.24 (sec) , antiderivative size = 73, normalized size of antiderivative = 2.28 \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 \, {\left (d x + c\right )} B a + B a {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + C a {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 2 \, C a \tan \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

1/2*(2*(d*x + c)*B*a + B*a*(log(sin(d*x + c) + 1) - log(sin(d*x + c) - 1)) + C*a*(log(sin(d*x + c) + 1) - log(
sin(d*x + c) - 1)) + 2*C*a*tan(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 84 vs. \(2 (32) = 64\).

Time = 0.28 (sec) , antiderivative size = 84, normalized size of antiderivative = 2.62 \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {{\left (d x + c\right )} B a + {\left (B a + C a\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (B a + C a\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1}}{d} \]

[In]

integrate(cos(d*x+c)*(a+a*sec(d*x+c))*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

((d*x + c)*B*a + (B*a + C*a)*log(abs(tan(1/2*d*x + 1/2*c) + 1)) - (B*a + C*a)*log(abs(tan(1/2*d*x + 1/2*c) - 1
)) - 2*C*a*tan(1/2*d*x + 1/2*c)/(tan(1/2*d*x + 1/2*c)^2 - 1))/d

Mupad [B] (verification not implemented)

Time = 15.95 (sec) , antiderivative size = 100, normalized size of antiderivative = 3.12 \[ \int \cos (c+d x) (a+a \sec (c+d x)) \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {C\,a\,\mathrm {tan}\left (c+d\,x\right )}{d}+\frac {2\,B\,a\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,B\,a\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}+\frac {2\,C\,a\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d} \]

[In]

int(cos(c + d*x)*(B/cos(c + d*x) + C/cos(c + d*x)^2)*(a + a/cos(c + d*x)),x)

[Out]

(C*a*tan(c + d*x))/d + (2*B*a*atan(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d + (2*B*a*atanh(sin(c/2 + (d*x)/2)
/cos(c/2 + (d*x)/2)))/d + (2*C*a*atanh(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/d